Component({
  properties: {
    show: {
      type: Boolean,
      value: false
    }
  },

  data: {
    currentSize: 'normal',
    sizes: [
      { name: '标准', value: 'normal' },
      { name: '大号', value: 'large' },
      { name: '特大', value: 'xlarge' }
    ]
  },

  lifetimes: {
    attached() {
      const app = getApp()
      const fontSize = app.getFontSize()
      this.setData({
        currentSize: fontSize
      })
    }
  },

  methods: {
    // 选择字体大小
    selectFontSize(e) {
      const size = e.currentTarget.dataset.size
      this.setData({
        currentSize: size
      })
    },

    // 保存字体大小设置
    saveFontSize() {
      const app = getApp()
      app.setFontSize(this.data.currentSize)
      
      this.triggerEvent('close')
      wx.showToast({
        title: '设置成功',
        icon: 'success',
        duration: 1500
      })
    },

    // 关闭设置面板
    closePanel() {
      this.triggerEvent('close')
    }
  }
}) 